Skip to content

Implement update mode for integration tests (#3536)#3551

Merged
AlexanderSavelyev merged 1 commit intomasterfrom
3536-update-mode-for-integration-tests
Apr 6, 2026
Merged

Implement update mode for integration tests (#3536)#3551
AlexanderSavelyev merged 1 commit intomasterfrom
3536-update-mode-for-integration-tests

Conversation

@MaksimDaniliuk
Copy link
Copy Markdown
Collaborator

Implemented an update mode for integration tests. The functionality is triggered when the CLI command includes the -u flag, enabling update mode.

Update mode updates global reference files. In addition, compare_dif function has been added to control reference update before calculating a "diff".

@MaksimDaniliuk MaksimDaniliuk force-pushed the 3536-update-mode-for-integration-tests branch 3 times, most recently from 8f8a99e to 03f6ab9 Compare March 18, 2026 15:47
raise e


def compare_dif(file_path, out_data, find_diff=None, is_update_required=None):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to compare_diff


def compare_dif(file_path, out_data, find_diff=None, is_update_required=None):
try:
is_update_required
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this check?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just make default is_update_required=False

with open(file_path, "w", encoding="utf-8") as file:
file.write(out_data)

if find_diff is None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this parameter

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use just default find_diff


path_to_ref = os.path.join(ref_path, filename + ".ket")
diff = compare_dif(path_to_ref, ket, find_diff, update_required)
if not diff:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move print to compare_diff

diff = compare_dif(
path_to_ref_cdxml, cdxml_text, find_diff, update_required
)
if not diff:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move print to compare_diff

ket_ref = file.read()
ket = mol.json()
diff = find_diff(ket_ref, ket)
path_to_ref_ket = os.path.join(ref_path, filename + ".ket")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where update_required is taken

@AlexanderSavelyev AlexanderSavelyev linked an issue Mar 23, 2026 that may be closed by this pull request
@MaksimDaniliuk MaksimDaniliuk force-pushed the 3536-update-mode-for-integration-tests branch 6 times, most recently from 609f2e0 to 825c3d7 Compare April 3, 2026 11:45
@MaksimDaniliuk MaksimDaniliuk force-pushed the 3536-update-mode-for-integration-tests branch from 825c3d7 to 541f131 Compare April 3, 2026 12:59
@AlexanderSavelyev AlexanderSavelyev merged commit c0ed528 into master Apr 6, 2026
62 checks passed
@AlexanderSavelyev AlexanderSavelyev deleted the 3536-update-mode-for-integration-tests branch April 6, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement update mode for integration tests

2 participants